package com.itfenghuang.day02;



public class A03_总结 {
    public static void main(String[] args) {

         Animal1 animal1= new Cat1();
         Animal1 animal2= new Dog1();
         animal1.eat();
         animal2.eat();
    }
}

class AnimalTool {
    public static void eat(Cat1 cat){
        cat.eat();
    }

    public static void eat(Dog1 dog){
        dog.eat();
    }

    public static void eat(Pig pig){
        pig.eat();
    }
    public  void  keepPet(Animal1 animal, String something){
        String name=animal.getName();
        System.out.println("喂"+name+"吃"+something);
    }
}

abstract class Animal1 {
    public abstract void eat();
    public abstract void  keepPet(String something);
    public abstract String getName();
}

class Cat1 extends Animal1 {
    @Override
    public void eat() {
        System.out.println("吃鱼");
    }
    @Override
    public void keepPet(String something) {

    }
    @Override
    public String getName() {
        return "猫";
    }
}
class Dog1 extends Animal1 {
    @Override
    public void eat() {
        System.out.println("吃肉");
    }
    @Override
    public void keepPet(String something) {

    }
    @Override
    public String getName() {
        return "狗";
    }
}
class Pig extends Animal1 {
    @Override
    public void eat() {

    }
    @Override
    public void keepPet(String something) {

    }
    @Override
    public String getName() {
        return "猪";
    }
}